/*  1:   */ package org.jetbrains.debugger;
/*  2:   */ 
/*  3:   */

import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.AsyncValueLoaderManager;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.debugger.values.ObjectValue;
import org.jetbrains.debugger.values.ValueManager;

import java.util.List;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */ 
/* 13:   */ public abstract class DeclarativeScope<VALUE_LOADER extends ValueManager>
/* 14:   */   extends ScopeBase
/* 15:   */ {
/* 16:15 */   private static final AsyncValueLoaderManager<DeclarativeScope, List<Variable>> c = new AsyncValueLoaderManager(DeclarativeScope.class)
/* 17:   */   {
/* 18:   */     public boolean isUpToDate(@NotNull DeclarativeScope paramAnonymousDeclarativeScope, @NotNull List<Variable> paramAnonymousList)
/* 19:   */     {
/* 20:19 */       if (paramAnonymousDeclarativeScope == null) {
/* 21:19 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/DeclarativeScope$1", "isUpToDate" }));
/* 22:   */       }
/* 23:19 */       if (paramAnonymousList == null) {
/* 24:19 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/DeclarativeScope$1", "isUpToDate" }));
/* 25:   */       }
/* 26:19 */       return paramAnonymousDeclarativeScope.valueManager.getCacheStamp() == paramAnonymousDeclarativeScope.e;
/* 27:   */     }
/* 28:   */     
/* 29:   */     public void load(@NotNull DeclarativeScope paramAnonymousDeclarativeScope, @NotNull AsyncResult<List<Variable>> paramAnonymousAsyncResult)
/* 30:   */     {
/* 31:24 */       if (paramAnonymousDeclarativeScope == null) {
/* 32:24 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/DeclarativeScope$1", "load" }));
/* 33:   */       }
/* 34:24 */       if (paramAnonymousAsyncResult == null) {
/* 35:24 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/DeclarativeScope$1", "load" }));
/* 36:   */       }
/* 37:24 */       paramAnonymousDeclarativeScope.loadVariables(paramAnonymousAsyncResult);
/* 38:   */     }
/* 39:   */   };
/* 40:   */   private volatile AsyncResult<List<? extends Variable>> d;
/* 41:31 */   private volatile int e = -1;
/* 42:   */   protected final VALUE_LOADER valueManager;
/* 43:   */   
/* 44:   */   protected DeclarativeScope(@NotNull Scope.Type paramType, @Nullable String paramString, @NotNull VALUE_LOADER paramVALUE_LOADER)
/* 45:   */   {
/* 46:36 */     super(paramType, paramString);
/* 47:   */     
/* 48:38 */     this.valueManager = paramVALUE_LOADER;
/* 49:   */   }
/* 50:   */   
/* 51:   */   protected abstract void loadVariables(@NotNull AsyncResult<List<? extends Variable>> paramAsyncResult);
/* 52:   */   
/* 53:   */   protected final void updateCacheStamp()
/* 54:   */   {
/* 55:47 */     this.e = this.valueManager.getCacheStamp();
/* 56:   */   }
/* 57:   */   
/* 58:   */   protected final void loadScopeObjectProperties(@NotNull ObjectValue paramObjectValue, @NotNull final AsyncResult<List<? extends Variable>> paramAsyncResult)
/* 59:   */   {
/* 60:51 */     if (paramObjectValue == null) {
/* 61:51 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/jetbrains/debugger/DeclarativeScope", "loadScopeObjectProperties" }));
/* 62:   */     }
/* 63:51 */     if (paramAsyncResult == null) {
/* 64:51 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "1", "org/jetbrains/debugger/DeclarativeScope", "loadScopeObjectProperties" }));
/* 65:   */     }
/* 66:51 */     paramObjectValue.getProperties().doWhenDone(new Consumer()
/* 67:   */     {
/* 68:   */       public void consume(List<Variable> paramAnonymousList)
/* 69:   */       {
/* 70:54 */         DeclarativeScope.this.updateCacheStamp();
/* 71:55 */         paramAsyncResult.setDone(paramAnonymousList);
/* 72:   */       }
/* 73:55 */     }).notifyWhenRejected(paramAsyncResult);
/* 74:   */   }
/* 75:   */   
/* 76:   */   @NotNull
/* 77:   */   public final AsyncResult<List<Variable>> getVariables()
/* 78:   */   {
/* 79:63 */     AsyncResult tmp7_4 = c.get(this);
/* 80:63 */     if (tmp7_4 == null) {
/* 81:63 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/DeclarativeScope", "getVariables" }));
/* 82:   */     }
/* 83:63 */     return tmp7_4;
/* 84:   */   }
/* 85:   */   
/* 86:   */   @NotNull
/* 87:   */   public ActionCallback clearCaches()
/* 88:   */   {
/* 89:69 */     this.e = -1;
/* 90:70 */     c.reset(this); ActionCallback 
/* 91:71 */       tmp15_12 = ActionCallback.DONE;
/* 92:71 */     if (tmp15_12 == null) {
/* 93:71 */       throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/jetbrains/debugger/DeclarativeScope", "clearCaches" }));
/* 94:   */     }
/* 95:71 */     return tmp15_12;
/* 96:   */   }
/* 97:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.jetbrains.debugger.DeclarativeScope

 * JD-Core Version:    0.7.0.1

 */